package com.nike.controller;

import java.util.Date;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Model;
import com.nike.utils.DateUtils;

public class BaseController<M extends Model<M>> extends Controller {

	/**
	 * 通用新增
	 * 
	 */
	public void saved(Model<M> model) {
		model.set("createDate", DateUtils.format(new Date()));
		model.set("modifyDate", DateUtils.format(new Date()));
		model.save();
	}

	/**
	 * 通用修改
	 * 
	 */
	public void updated(Model<M> model) {
		model.set("modifyDate", DateUtils.format(new Date()));
		model.update();
	}
	
	
	public void addActionError(String error){
		setAttr("errorMessages", error);
		//render("/admin/error.html");	
	}

}
